home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
ZSI
/
auth.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
2KB
|
66 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
from ZSI import *
from ZSI import _copyright
import base64
import os
_b64_decode = base64.decodestring
_auth_tc = TC.Struct(None, [
TC.String('Name'),
TC.String('Password')], extras = 1)
class AUTH:
none = 0
httpbasic = 1
zsibasic = 2
httpdigest = 4
class ClientBinding:
def __init__(self, ps):
self.ps = ps
self.auth = None
self.environ = os.environ.copy()
self.environ['CONTENT_LENGTH'] = str(0)
def GetAuth(self):
if self.auth:
return self.auth
for elt in self.ps.GetMyHeaderElements():
if elt.localName == 'BasicAuth' and elt.namespaceURI == ZSI_SCHEMA_URI:
d = _auth_tc.parse(elt, self.ps)
self.auth = (AUTH.zsibasic, d['Name'], d['Password'])
return self.auth
continue
ba = self.environ.get('HTTP_AUTHENTICATION')
if ba:
ba = ba.split(' ')
if len(ba) == 2 and ba[0].lower() == 'basic':
ba = _b64_decode(ba[1])
self.auth = (AUTH.httpbasic,) + tuple(ba.split(':'))
return self.auth
self.auth = (AUTH.none,)
return self.auth
def GetNS(self):
if not self.ps.body_root.namespaceURI:
pass
return ''
def GetRequest(self):
return self.ps
if __name__ == '__main__':
print _copyright